package com.xca.znb.model.impl;

import android.content.Context;

import com.xca.znb.database.UserDAO;
import com.xca.znb.entity.Collect;
import com.xca.znb.entity.Goods;
import com.xca.znb.entity.Local;
import com.xca.znb.entity.NewsLetter;
import com.xca.znb.entity.User;
import com.xca.znb.model.imodel.IGoodsDetail;

public class GoodsDetailImpl implements IGoodsDetail {
    private UserDAO userDAO ;
    public GoodsDetailImpl(Context context){userDAO = new UserDAO(context) ;}
    @Override
    public Goods getGoodsById(int id) {
        return userDAO.getGoodsById(id);
    }

    @Override
    public User getUserByPhone(String phone) {
        return userDAO.getUser(phone);
    }

    @Override
    public void addNewsletter(String phone1, String phone2, String time) {
        userDAO.addNewsletter(phone1, phone2, time);
    }

    @Override
    public NewsLetter getNewsLetterByPhone(String phone1, String phone2) {
        return userDAO.getNewsletterByPhone(phone1, phone2);
    }

    @Override
    public int getLocalDefaultId(String phone) {
        return userDAO.getLocalDefaultId(phone);
    }

    @Override
    public void addCollect(String gId, String type, String user) {
        userDAO.addCollect(gId, type, user);
    }

    @Override
    public void delCollect(int id) {
        userDAO.delCollect(id);
    }

    @Override
    public Collect getCollect(String gId, String type, String user) {
        return userDAO.getCollect(gId,type,user);
    }

    @Override
    public void addCart(int goodsId, int num, String user) {
        userDAO.addCart(goodsId , num , user);
    }

}
